<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="framelib.common.FrameCommon"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@include file="includes/import.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
<script type="text/javascript" src="<%=basePathHeader%>/JAVAScripts/common/formValidator-4.1.1.js"></script>
<script type="text/javascript" src="<%=basePathHeader%>/JAVAScripts/common/formValidatorRegex.js"></script>
<script type="text/javascript" src="<%=basePathHeader%>/JAVAScripts/common/jquery.form.js"></script>
<link rel="stylesheet" href="<%=basePathHeader%>/styles/userInfo.css"
	type="text/css" />
<script type="text/javascript" language="javascript">
$(document).ready(function(){
	$.formValidator.initConfig({theme:"126",submitOnce:true,formID:"userRegister",
		onError:function(msg){},
		submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
	});
	$("#password2").formValidator({onShowFixText:"",onShow:"请输入密码",onFocus:"至少1个长度",onCorrect:" "}).inputValidator({min:6,max:16,empty:{leftEmpty:false,rightEmpty:false,emptyError:"密码两边不能有空符号"},onError:"密码长度错误,请确认"}).passwordValidator({compareID:"us"});
	$("#securityEmail").formValidator({onShowFixText:"",onShow:"请输入邮箱",onFocus:"",onCorrect:"此邮箱可用",defaultValue:""}).inputValidator({min:0,max:200,onError:"你输入的邮箱长度非法,请确认"}).regexValidator({regExp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onError:"你输入的邮箱格式不正确"});
	$("#passwordTip").html("");
});

function userSecurityEmail() {
	var options = {
	      url: '<%=basePathHeader %>/user/updateSecurityEmail.htm',
	      type: 'post',
	      data: $('#securityEmail').serialize() + '&' + $('#password').serialize(),
	      success: function(data) {
			if(data == 'success'){
				$('#emailMessage').html("安全邮箱修改成功");
			}else if(data == 'error'){
				$('#emailMessage').html("密码错误，请重新输入");
			}
	      },
	      fail : function(){$('#emailMessage').html("安全邮箱修改失败");}
    	}
		$('#updateSecurityEmail').ajaxSubmit(options); 
}
</script>
	</head>

	<body>
		<c:import url="includes/header.jsp" />
		<div class="info">
			<c:import url="includes/userLeft.jsp" />
			<div class="right">
				<div class="userSerinfo">
					<div  class="userSerinfoavatar">
						<img src="<%=imagePath %>avatarMid/<c:out value="${sessionScope.pnnSession.avatar}"/>"/>
					</div>
					<div  class="userSerBasicinfo">
						<p style="font-size: 22px;font-family: 微软雅黑;font-weight: bold;"><c:out value="${sessionScope.pnnSession.nickName}"/></p>
						<p style="font-size: 14px;font-family: 微软雅黑;"><c:out value='${sessionScope.pnnSession.userParams[1].extValue}'/>，<c:out value='${sessionScope.pnnSession.userParams[2].extValue}'/>，<c:out value='${sessionScope.pnnSession.userParams[3].extValue}'/></p>
						<p style="font-size: 14px;font-family: 微软雅黑;"></p>
					</div>
				</div>
				
				<div class="editPass">
				<form id="updateSecurityEmail" action="<%=basePathHeader %>/user/updateSecurityEmail.htm" method="post">	
					<div class="reg_user">
						<label>当前安全邮箱：</label>
						 <div class="reg_useright">
			 			 <c:out value="${sessionScope.pnnSession.securityEmail}"></c:out>
			 			 <span id="password0Tip" class="reg_note col_999"></span>
						 </div>
						 <div class="clear"></div>
				 	</div>
				 	<div class="reg_user">
				       <label>新安全邮箱：</label>
					 <div class="reg_useright">
		 			 <input type="text" id="securityEmail" name="securityEmail" />
		 			 <span id="securityEmailTip" class="reg_note col_999"></span>
					 </div>
				 	 <div class="clear"></div>
				 	</div>
						 
			       <div class="reg_user">
				       <label>聚哪密码：</label>
					 <div class="reg_useright">
		 			 <input type="password" id="password2" name="password" />
		 			 <span id="passwordTip" class="reg_note col_999"></span>
					 </div>
					 <div class="clear"></div>
				 	</div>
				 	<div id="emailMessage" class="pass_message font_red"></div>
				 	<span class="reg_infobtn" onclick="userSecurityEmail()"></span>
				 </form>
				</div>
			</div>
		</div>

		<c:import url="includes/footer.jsp" />
	</body>
</html>
